define(['plugins/router', 'knockout'], function(router, ko) {
	// child shell :app-cms/doc/shell
	var emptyRoute='<<empty>>';
	var previousRoute=emptyRoute;
	var defaultRoute='doc/enterprise/1';
	var childRouter = router.createChildRouter()
		.makeRelative({
			moduleId: 'app-ice/doc',
			fromParent: true,
		}).map([
			{route: ['','enterprise*splat'],moduleId: 'template/index',title: '企业内容库',nav: true,hash:'#doc/enterprise'},
			{route: 'team',moduleId: 'template/index',title: '团队内容库',nav: true},
			{route: 'person',moduleId: 'template/index',title: '个人内容库',nav: true},
			{route: 'my-message',moduleId: 'template/index',title: '我的消息',nav: true},
			{route: 'my-favorite',moduleId: 'template/index',title: '我的收藏',nav: true},
			{route: 'my-outpublish',moduleId: 'template/index',title: '我的外发',nav: true},
			{route: 'my-subscribe',moduleId: 'template/index',title: '我的订阅',nav: true},
			{route: 'my-share',moduleId: 'template/index',title: '我的共享',nav: true},
			{route: 'my-lock',moduleId: 'template/index',title: '我的锁定',nav: true},
			{route: 'share-to-me',moduleId: 'template/index',title: '共享给我',nav: true},
			{route: 'my-tag',moduleId: 'my-tag/index',title: '我的标签',nav: true},
		]).buildNavigationModel();
		
	return {
		router: childRouter,
		activate :function (...rest) {
			debugger;
			childRouter;
//			//说明是通过浏览器访问url进行第一次加载，不进行处理
			if(previousRoute===emptyRoute){
				previousRoute=defaultRoute;
			}else{
				var currentRoute=rest[0];
				if(currentRoute===null){//说明是通过点击根路由跳转过来的 
					router.navigate(previousRoute);
				}else{
					previousRoute='doc'+currentRoute;
				}
			}
			console.log(rest);
		}
	}
})